<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta charset="utf-8" name="viewport"
        content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
    <title>Search Results</title>
    <link rel="stylesheet" href="/media/css/index.css">
</head>

<body>
    <h1>课程：</h1>
    {% if lessons %}
    {% for lesson in lessons %}
    <div class="lesson-card">
        <h2><a href="{% url 'lesson:lesson' lesson.id %}">{{lesson.name}}</a></h2>
        <p class="tag">{{ lesson.teacher }}</p>
        <p class="quote-symbol">“</p>
        <div class="lesson-discription">
            {{ lesson.bestcomment.comment }}
        </div>
        <p class="comment-tag">{{ lesson.bestcomment.name }} {{ lesson.bestcomment.term }}</p>
    </div>
    {% endfor %}
    {% else %}
    <p>No Lesson Found</p>
    {% endif %}
    <h1>评论：</h1>
    {% if comments %}
    {% for comment in comments %}
    <div class="lesson-card">
        <div class="lesson-discription">
            {{ comment.comment }}
        </div>
        <p class="comment-tag">{{ comment.name }} 学期:{{ comment.term }} 得分:{{ comment.score }}</p>
        <div class="like-it">
            <div class="comment-likes">{{ comment.likes }}</div>
            <form class="like-comment" action="." method="POST">
                {% csrf_token %}
                <input type="hidden" name="type" value="comment">
                <input type="hidden" name="id" value="{{ comment.id }}">
                <input class="like-button" type="submit" value="👍">
            </form>
        </div>
    </div>
    {% endfor %}
    {% else %}
    <p>No Comment Found</p>
    {% endif %}
</body>

</html>